import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:xiongan_app_yy/widgets/comm/left_icon_widget.dart';
import 'package:xiongan_app_yy/widgets/comm/text_card_widget.dart';
import 'package:xiongan_app_yy/widgets/comm/text_exhibition_card_widget.dart';
import 'package:xiongan_app_yy/widgets/dialog.dart';

class DeploymentDetailsNew extends StatefulWidget {
  final Map<String, dynamic> args;

  DeploymentDetailsNew(this.args);

  @override
  _DeploymentDetailsNewState createState() => _DeploymentDetailsNewState();
}

class _DeploymentDetailsNewState extends State<DeploymentDetailsNew> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        centerTitle: true,
        title: Text("调配预约详情", style: TextStyle(fontSize: 18)),
        leading: LeftIconWidget(icon: Icons.chevron_left, isize: 36),
      ),
      backgroundColor: Color(0xf4f4f4f4),
      body: Column(
        children: <Widget>[
          Offstage(
            child: Container(
              height: 86,
              width: double.infinity,
              margin: EdgeInsets.only(bottom: 8),
              decoration: BoxDecoration(color: Colors.white),
              child: Scrollbar(
                  child: SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Container(
                      width: 80,
                      height: 80,
                      child: Image.asset(
                        "assets/images/real_background.png",
                        fit: BoxFit.fill,
                      ),
                    ),
                    Container(
                      width: 80,
                      height: 80,
                      child: Image.asset(
                        "assets/images/real_background.png",
                        fit: BoxFit.fill,
                      ),
                    ),
                    Container(
                      width: 80,
                      height: 80,
                      child: Image.asset(
                        "assets/images/real_background.png",
                        fit: BoxFit.fill,
                      ),
                    ),
                    Container(
                      width: 80,
                      height: 80,
                      child: Image.asset(
                        "assets/images/real_background.png",
                        fit: BoxFit.fill,
                      ),
                    ),
                  ],
                ),
              )),
            ),
          ),
          Expanded(
              child: Container(
            width: MediaQuery.of(context).size.width,
            color: Colors.white,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding: EdgeInsets.all(10),
                  child: Text(
                    "预约二维码",
                    style: TextStyle(color: Color(0xff323232), fontSize: 16),
                  ),
                ),
                Container(
                  height: 180,
                  padding: EdgeInsets.all(10),
                  child: Center(
                    child: GestureDetector(
                      child: QrImage(
                        data: "6666",
                        version: QrVersions.auto,
                      ),
                      onTap: () {},
                    ),
                  ),
                ),
                Expanded(
                    child: Scrollbar(
                        child: SingleChildScrollView(
                  scrollDirection: Axis.vertical,
                  child: Column(
                    children: <Widget>[
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "原因",
                          exhibitionText: "未知"),
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "调配申请单",
                          exhibitionText: "12321314142"),
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "车牌号码",
                          exhibitionText: "浙A888888"),
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "司机姓名",
                          exhibitionText: "张三"),
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "手机号",
                          exhibitionText: "12321314142"),
                      TextExhibitionCardWidget(
                          distance: EdgeInsets.only(
                              right: 15, left: 15, bottom: 16, top: 16),
                          title: "取货时间",
                          exhibitionText: "2019-09-12"),
                      TextCardWidget(
                          onPressed: () {
                            //Navigator.pushNamed(context, "/storageDetails",arguments: detailsBean);
                            Navigator.pushNamed(context, '/deliveryDetailsList',
                                arguments: {"type": "pull", "title": "物资明细"});
                          },
                          title: "物资明细",
                          border: Border(
                              bottom: BorderSide(
                                  width: 1, color: Color(0xffdddddd)),
                              top: BorderSide(
                                  width: 1, color: Color(0xffdddddd))))
                    ],
                  ),
                ))),
                Container(
                    width: double.infinity,
                    child: Center(
                      child: Container(
                        width: 160,
                        height: 48,
                        margin: EdgeInsets.only(bottom: 10),
                        child: FlatButton(
                          color: Color(0XFF00A5F1),
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)),
                          child: Text(
                            "重新预约",
                            style: TextStyle(color: Colors.white),
                          ),
                          onPressed: () async {
                            String title = '重新预约';
                            String contenText = '是否重新填写信息，重新预约';
                            String cancleText = '取消';
                            String sureText = '重新填写';
                            bool dialogChoice = await showDeleteConfirmDialog1(
                                context,
                                title,
                                contenText,
                                cancleText,
                                sureText);
                            if (dialogChoice == null) {
                              print("取消更新");
                            } else {
                              print("确认更新");
                            }
                          },
                        ),
                      ),
                    ))
              ],
            ),
          )),
        ],
      ),
    );
  }
}
